package com.linewow.xhyy.nihaonew.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

import com.linewow.xhyy.nihaonew.R;
import com.linewow.xhyy.nihaonew.application.NiHaoApp;
import com.linewow.xhyy.nihaonew.base.BaseFragmentActivity;
import com.linewow.xhyy.nihaonew.entity.tag.TagListInfo;
import com.linewow.xhyy.nihaonew.fragment.TagDetailCustomFragment;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by LXR on 2016/9/8.
 * 碎片--->
 */
public class TagDetailCustomActivity extends BaseFragmentActivity {
    @Bind(R.id.toolbar_back_title)
    TextView toolbarBackTitle;
    @Bind(R.id.toolbar_back_left)
    ImageView toolbarBackLeft;
    @Bind(R.id.toolbar_back_toolbar)
    Toolbar toolbarBackToolbar;
    private String TAG="TagDetailCustomActivity";
    private TagListInfo tagListInfo;
    private String key="msg";
    private FragmentManager fm;
    private TagDetailCustomFragment tagDetailFragment;

    @Override
    public void initView() {
        super.initView();
        setContentView(R.layout.activity_tag_detail);
        ButterKnife.bind(this);
        fm=getSupportFragmentManager();
    }

    @Override
    public void initList() {
        super.initList();
    }

    @Override
    public void initData() {
        super.initData();
        tagListInfo=getIntent().getParcelableExtra(key);
        tagDetailFragment=new TagDetailCustomFragment();
        Bundle bundle=new Bundle();
        Log.e(TAG,"打印tagid"+tagListInfo.tagid);
        bundle.putString(key,tagListInfo.tagid);
        tagDetailFragment.setArguments(bundle);
        fm.beginTransaction().add(R.id.tag_detail_frame,tagDetailFragment).commit();
        if(!NiHaoApp.EnglishFlag){
            toolbarBackTitle.setText(tagListInfo.zhcn);
        }else{
            toolbarBackTitle.setText(tagListInfo.en);
        }
    }



    @OnClick(R.id.toolbar_back_left)
    public void onClick() {
        finish();
    }
}
